# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Angel 'angvp' Velasquez <angvp[at]archlinux.com.ve>

pkgname=python-pycurl
pkgver=7.45.2
pkgrel=3
pkgdesc="A Python 3.x interface to libcurl"
arch=('x86_64')
url="http://pycurl.sourceforge.net/"
license=('LGPL' 'MIT')
depends=('python' 'curl')
makedepends=('python-setuptools')
checkdepends=('python-bottle' 'python-pytest' 'vsftpd' 'python-flaky' 'python-pyflakes')
source=("https://github.com/pycurl/pycurl/archive/REL_${pkgver//./_}/$pkgname-$pkgver.tar.gz")
sha512sums=('c27d500a310124b0972eaeb424afc2878e0cd59bec9841ec0dcff3485a76e78b53438d9bf9c035658058d7c118e3e5ecd426e0733cbd251261135c6a504f2edf')

prepare() {
  mv pycurl-REL_${pkgver//./_} pycurl-$pkgver
}

build() {
  cd pycurl-$pkgver
  make
  python setup.py build
}

check() {
  export PYCURL_VSFTPD_PATH=vsftpd
  # We don't have HTTP2 enabled

  cd pycurl-$pkgver
  PYTHONPATH="$PWD/build/lib.linux-$CARCH-3.10:$PYTHONPATH" make test || warning "Tests failed"
}

package() {
  cd pycurl-$pkgver
  python setup.py install -O1 --root="$pkgdir"
  install -Dm644 COPYING-MIT -t "$pkgdir"/usr/share/licenses/$pkgname/
}
